#include <stdio.h>

int main() 
{
  char *s = "fuck";
  printf("what a %s. \n" ,s);

  int c = '0';
  int index = string_index_of(s, c);
  printf("index is %d. \n", index);

  int result = strcmp("whdt" , "whbc");
  printf("result is %d. \n", result);

}

int string_index_of(const char *s, int c) 
{
  int count = 0;
  char *p = s;
  while ( *p++) {
    count++; 
    if (*p == c) return count;
  }
  return -1;
}


int strcmp(char *s, char *t)
{
  for ( ; *s == *t; s++, t++)
    if (*s == '\0')
      return 0;
  return *s - *t;
}

